import { http } from "@/utils/http";
import type {
  ConclusionProjectCmd,
  PageVoProjectListVo,
  ProjectConclusionDetailsVo,
  ProjectCreateCmd,
  ProjectDetailsVo,
  ProjectInfoUpdate,
  ProjectInitVo
} from "@/api/models";

export const allProject = (current: number, size: number, keyword: string) => {
  return http.get("/project/project/all-project", {
    params: { current, size, keyword }
  });
};
export const myProject = (
  keyword: string,
  current: number,
  size: number,
  isCharge?: boolean,
  status?: number
) => {
  return http.get<PageVoProjectListVo>("/project/project/my-project", {
    params: { current, size, keyword, status, isCharge }
  });
};
export const projectDetails = (projectId: string) => {
  return http.get<ProjectDetailsVo>("/project/project/details", {
    params: { projectId }
  });
};

export const initProject = () => {
  return http.post<ProjectInitVo>("/project/project/init");
};
export const submitProject = (projectAdd: ProjectCreateCmd) => {
  return http.post<string>("/project/project/submit", { data: projectAdd });
};
export const deleteProject = (projectId: string) => {
  return http.delete("/project/project/delete", { params: { projectId } });
};
export const updateProject = (projectUpdate: ProjectInfoUpdate) => {
  return http.put("/project/project/update", { data: projectUpdate });
};
export const conclusionDetails = (projectId: string) => {
  return http.get<ProjectConclusionDetailsVo>(
    "/project/project/conclusion-details",
    { params: { projectId } }
  );
};
export const conclusionProject = (conclusion: ConclusionProjectCmd) => {
  return http.post<string>("/project/project/conclusion-project", {
    data: conclusion
  });
};
